var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0}),
    (o.sps = void 0),
    (function (t) {
        t.names = new Array();
        var e,
            o = {},
            n = {},
            r = {};
        function a(t) {
            e = t;
        }
        (t.init = function (e, n) {
            a(1);
            for (var r = e.replace(/^\s*|\s*$/g, "").split(/\s*\n\s*/), i = {}, s = r.length / 3, c = 0; c < s; c++) {
                var l = r[3 * c];
                t.names.push(l),
                    (o[l] = {skel: r[3 * c + 1], atlas: r[3 * c + 2].replace(/#/g, "\n"), texName: null}),
                    i[o[l].skel] ? (o[l].skel = i[o[l].skel]) : (i[l] = o[l].skel),
                    (o[l].texName = o[l].atlas.match(/(\w+)\.png/)[1]);
            }
            this.addSps(n);
        }),
            (t.addSps = function (t) {
                for (var e = 0, o = t; e < o.length; e++) {
                    var r = o[e];
                    console.log("addSp " + r.name), (n[r.name] = r.getTexture());
                }
            }),
            (t.setTimeScale = a),
            (t.getSkel = function (t) {
                var a = r[t];
                if (a);
                else {
                    if (!o[t]) return console.error("木有 " + t), null;
                    (r[t] = a = new sp.SkeletonData()),
                        (a._uuid = t),
                        (a.skeletonJson = o[t].skel),
                        (a.atlasText = o[t].atlas),
                        (a.textures = [n[o[t].texName]]),
                        (a.textureNames = [o[t].texName + ".png"]);
                }
                var i = new cc.Node().addComponent(sp.Skeleton);
                return (i.skeletonData = a), (i.enableBatch = !0), (i.timeScale = e), i;
            });
    })(o.sps || (o.sps = {}));
